#define _CRT_SECURE_NO_WARNINGS 1

#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n, i;
	cin >> n >> i;
	int cnt = n;
	vector<int> v(n+1,0);
	vector<pair<int, int>> pa(i+1);
	for(int k = 1;k<=i;k++)
	{
		int l, r;
		cin >> l >> r;
		pa[k] = { l,r };
		for (int j = l; j <= r; j++)
		{
			if (v[j] == 0)
				cnt--;
			v[j]++;
		}
	}
	for (int k = 1; k <= i; k++)
	{
		int l = pa[k].first, r = pa[k].second;
		int ans = cnt;
		for (int j = l; j <= r; j++)
		{
			if (v[j] == 1)
				ans++;
		}
		cout << ans << endl;
	}


	return 0;
}